#include <am.h>
#include <klib.h>
#include <klib-macros.h>

#define IP_BASE_ADDR 0x10004000
#define REG_CTRL *((volatile uint32_t *)(IP_BASE_ADDR))
#define REG_DATA *((volatile uint32_t *)(IP_BASE_ADDR + 4))
#define REG_STAT *((volatile uint32_t *)(IP_BASE_ADDR + 8))

int main(){
    putstr("ps2 test\n");
    REG_CTRL = (uint32_t)3;
    uint32_t kdb_code;
    for(int i = 0; i < 10; ) {
        kdb_code = REG_DATA;
        if(kdb_code != 0) {
            printf("i: %d dat: %x\n", i, kdb_code);
            ++i;
        }
    }
    return 0;
}
